import { defineComponent, reactive, onMounted, ref } from 'vue';
import Draw from './draw'
import {parkSum} from "@/api/api";
import axios from "axios";
import {useRoute} from "vue-router";
export default defineComponent({
  components: {
    Draw
  },
  setup() {
    const route = useRoute();
    const { url } = route.params;
    const cdata = reactive({
      y:[],
    })
    const setlist = () => {
      // @ts-ignore
      parkSum(url+'dataView/user/addedUsersM',{})
          .then(res=>{

              for (let i = 0; i < res.data.length; i++) {
                cdata.y.push(res.data[i].y);
              }
      });
      // parkSum('dataView/user/addedUsersM',{})
      //     .then(res=>{
      //       for (let i = 0; i < res.data.length; i++) {
      //         cdata.y.push(res.data[i].y);
      //       }
      //           //this.y = { ...this.y
      //         }
      //     );
    }
    // 生命周期
    onMounted(() => {
      setlist()
    })

    return () => {
      return <div>
        <Draw cdata={cdata} />
      </div>
    }
  }
})